-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf(@angular-devkit/build-angular): inject Sass import/use directive importer information when resolving #25534
Conversation
67916f5
to
0cc760a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any existing unit tests for this functionality we should be updating as well? Or is the existing integration test suite sufficient for this change, given that it's a performance optimization which shouldn't observably change anything?
packages/angular_devkit/build_angular/src/tools/sass/rebasing-importer.ts
Outdated
Show resolved
Hide resolved
packages/angular_devkit/build_angular/src/tools/sass/rebasing-importer.ts
Outdated
Show resolved
Hide resolved
packages/angular_devkit/build_angular/src/tools/sass/rebasing-importer.ts
Outdated
Show resolved
Hide resolved
packages/angular_devkit/build_angular/src/tools/sass/rebasing-importer.ts
Outdated
Show resolved
Hide resolved
packages/angular_devkit/build_angular/src/tools/sass/rebasing-importer.ts
Outdated
Show resolved
Hide resolved
packages/angular_devkit/build_angular/src/tools/sass/rebasing-importer.ts
Outdated
Show resolved
Hide resolved
e57753a
to
320e5fc
Compare
packages/angular_devkit/build_angular/src/tools/sass/rebasing-importer.ts
Show resolved
Hide resolved
packages/angular_devkit/build_angular/src/tools/sass/rebasing-importer.ts
Outdated
Show resolved
Hide resolved
… importer information when resolving To correctly resolve a package based import reference in a Sass file with pnpm or Yarn PnP, the importer file path must be known. Unfortunately, the Sass compiler does not provided the importer file to import plugins. Previously to workaround this issue, all previously resolved stylesheets were tried as the importer path. This allowed the stylesheets to be resolved but it also could cause a potentially large increase in build time due to the amount of previous stylesheets that would need to be tried. To avoid the performance impact and to also provide more accurate information regarding the importer file, a lexer is now used to extract import information for a stylesheet and inject the importer file path into the specifier. This information is then extracted from the import specifier during the Sass resolution process and allows the underlying package resolution access to a viable location to resolve the package for all package managers. This information is currently limited to specifiers referencing the `@angular` and `@material` package scopes but a comprehensive pre-resolution process may be added in the future.
320e5fc
to
425f04f
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
To correctly resolve a package based import reference in a Sass file with pnpm or Yarn PnP, the importer file path must be known. Unfortunately, the Sass compiler does not provided the importer file to import plugins. Previously to workaround this issue, all previously resolved stylesheets were tried as the importer path. This allowed the stylesheets to be resolved but it also could cause a potentially large increase in build time due to the amount of previous stylesheets that would need to be tried. To avoid the performance impact and to also provide more accurate information regarding the importer file, a lexer is now used to extract import information for a stylesheet and inject the importer file path into the specifier. This information is then extracted from the import specifier during the Sass resolution process and allows the underlying package resolution access to a viable location to resolve the package for all package managers. This information is currently limited to specifiers referencing the
@angular
and@material
package scopes but a comprehensive pre-resolution process may be added in the future.